package travlefate.story.adapter;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.joooonho.SelectableRoundedImageView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import travlefate.story.R;
import travlefate.story.activity.StoryInfoActivity;
import travlefate.story.activity.StoryLookActivity;
import travlefate.story.bean.ResultStory;
import travlefate.story.utils.Http;
import travlefate.story.utils.Loger;
import travlefate.story.views.SquareLayout;

/**
 * @author keven
 * @data 15/12/21 下午3:07
 * @package travlefate.story.adapter
 */
public class StoryListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private static final int TYPE_ITEM = 1, TYPE_FOOT = 2;
    private static final String TAG = "StoryListAdapter";
    private final Context context;
    private int single_width = 0;
    private double zoom_x1 = 0.65, zoom_x2 = 0.45;

    private ArrayList<ResultStory> mStorys = new ArrayList<>();

    public StoryListAdapter(Context context) {
        this.context = context;

        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        single_width = displayMetrics.widthPixels;
        Loger.i(TAG, "single_width:" + single_width);
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        RecyclerView.ViewHolder holder = null;
        View view;
        switch (viewType) {
            case TYPE_ITEM:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.type_story_item, null);
                holder = new ItemHolder(view);
                break;
            case TYPE_FOOT:
                view = LayoutInflater.from(parent.getContext()).inflate(R.layout.type_foot, null);
                holder = new FootHolder(view);
                break;
        }

        return holder;
    }

    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) {

        switch (getItemViewType(position)) {
            case TYPE_ITEM:

                final ItemHolder itemHolder = (ItemHolder) holder;
                final ResultStory story = mStorys.get(position);
                ResultStory.UserEntity user = story.getUser();

                itemHolder.itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent(context, StoryInfoActivity.class);
                        intent.putExtra("story", story);
                        context.startActivity(intent);
                    }
                });

                itemHolder.story_city.setText(TextUtils.isEmpty(story.getCity()) ? "" : story.getCity());
                itemHolder.story_comment.setText(TextUtils.isEmpty(story.getComment()) ? "" : story.getComment());
                itemHolder.story_like.setText(TextUtils.isEmpty(story.getReadcount()) ? "" : story.getReadcount());
                itemHolder.story_text.setText(TextUtils.isEmpty(story.getStory_info()) ? "" : story.getStory_info());
                itemHolder.story_nikename.setText(TextUtils.isEmpty(user.getUsername()) ? "" : user.getUsername());

                //设置发布时间
                String story_time = story.getStory_time();
                if (story_time != null) {
                    story_time += "000";
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    Date date = new Date();
                    date.setTime(Long.valueOf(story_time));
                    itemHolder.story_send_time.setText(sdf.format(date));
                } else {
                    itemHolder.story_send_time.setText("");
                }

                //设置性别
                if (user.getUsersex() == null) {

                } else if (user.getUsersex().equals("0")) {
                    itemHolder.story_sex.setImageResource(R.mipmap.ic_sex_man);
                } else {
                    itemHolder.story_sex.setImageResource(R.mipmap.ic_sex_woman);
                }

                //设置头像
                Picasso.with(context).load(Http.BASE_PORTRAIT + user.getPortrait()).resizeDimen(R.dimen.item_portrait_width_height, R.dimen.item_portrait_width_height).centerCrop().into(itemHolder.story_portrait);
                //设置故事图像加载
                List<String> pics = story.getPics();

                if (pics != null && !pics.isEmpty() && pics.size() == 1) {

                    //加载单图
                    itemHolder.story_single_image.setVisibility(View.VISIBLE);
                    itemHolder.story_more_image.setVisibility(View.GONE);
                    inflateSingleData(position, itemHolder, pics);

                } else if (pics != null && !pics.isEmpty()) {
                    //加载多图
                    itemHolder.story_single_image.setVisibility(View.GONE);
                    itemHolder.story_more_image.setVisibility(View.VISIBLE);

                    inflateMultipleData(position, itemHolder, pics);

                } else {
                    itemHolder.story_single_image.setVisibility(View.GONE);
                    itemHolder.story_more_image.setVisibility(View.GONE);
                }

                break;
            case TYPE_FOOT:
                break;
        }
    }

    /**
     * 加载单图
     *
     * @param position
     * @param itemHolder
     * @param pics
     */
    private void inflateSingleData(final int position, final ItemHolder itemHolder, List<String> pics) {
        final String url = Http.BASE_UPLOADS + pics.get(0);
        Picasso.with(context).load(url).into(itemHolder.story_single_image, new Callback() {
            @Override
            public void onSuccess() {
                BitmapDrawable drawable = (BitmapDrawable) itemHolder.story_single_image.getDrawable();
                Bitmap source = drawable.getBitmap();
                ViewGroup.LayoutParams params = itemHolder.story_single_image.getLayoutParams();
                //横图
                if (source.getWidth() > source.getHeight()) {
                    double single_imagewidth = single_width * zoom_x1;
                    double i = single_imagewidth / source.getWidth();
                    params.height = (int) (source.getHeight() * i);
                    params.width = (int) (source.getWidth() * i);
                } else {
                    //竖图
                    double single_imagewidth = single_width * zoom_x2;
                    double i = single_imagewidth / source.getWidth();
                    params.height = (int) (source.getHeight() * i);
                    params.width = (int) (source.getWidth() * i);
                }
            }

            @Override
            public void onError() {
                Loger.i(TAG, "loadImage:加载失败");
            }

        });


        itemHolder.story_single_image.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                context.startActivity(intent);
            }
        });
    }

    /**
     * 设置多图情况下 点击事件 以及 显示效果  在此 未使用GridView 避免 过多适配器刷新问题
     *
     * @param position
     * @param itemHolder
     * @param pics
     */

    private void inflateMultipleData(final int position, ItemHolder itemHolder, List<String> pics) {
        itemHolder.item_0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 0);
                context.startActivity(intent);
            }
        });
        itemHolder.item_1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 1);
                context.startActivity(intent);
            }
        });
        itemHolder.item_2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 2);
                context.startActivity(intent);
            }
        });
        itemHolder.item_3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 3);
                context.startActivity(intent);
            }
        });
        itemHolder.item_4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 4);
                context.startActivity(intent);
            }
        });
        itemHolder.item_5.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 5);
                context.startActivity(intent);
            }
        });
        itemHolder.item_6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 6);
                context.startActivity(intent);
            }
        });
        itemHolder.item_7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 7);
                context.startActivity(intent);
            }
        });
        itemHolder.item_8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Intent intent = new Intent(context, StoryLookActivity.class);
                intent.putExtra("story", mStorys.get(position));
                intent.putExtra("check", 8);
                context.startActivity(intent);
            }
        });

        if (pics.size() <= 9) {
            itemHolder.hasMore.setVisibility(View.GONE);
        } else {
            itemHolder.hasMore.setVisibility(View.VISIBLE);
        }

        switch (pics.size()) {
            case 2:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.GONE);
                itemHolder.item_3.setVisibility(View.GONE);
                itemHolder.item_4.setVisibility(View.GONE);
                itemHolder.item_5.setVisibility(View.GONE);
                itemHolder.item_6.setVisibility(View.GONE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                break;
            case 3:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.GONE);
                itemHolder.item_4.setVisibility(View.GONE);
                itemHolder.item_5.setVisibility(View.GONE);
                itemHolder.item_6.setVisibility(View.GONE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                break;
            case 4:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.GONE);
                itemHolder.item_5.setVisibility(View.GONE);
                itemHolder.item_6.setVisibility(View.GONE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                break;
            case 5:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.VISIBLE);
                itemHolder.item_5.setVisibility(View.GONE);
                itemHolder.item_6.setVisibility(View.GONE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(4)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_4.getChildAt(0));
                break;
            case 6:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.VISIBLE);
                itemHolder.item_5.setVisibility(View.VISIBLE);
                itemHolder.item_6.setVisibility(View.GONE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(4)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_4.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(5)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_5.getChildAt(0));
                break;
            case 7:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.VISIBLE);
                itemHolder.item_5.setVisibility(View.VISIBLE);
                itemHolder.item_6.setVisibility(View.VISIBLE);
                itemHolder.item_7.setVisibility(View.GONE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(4)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_4.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(5)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_5.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(6)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_6.getChildAt(0));
                break;
            case 8:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.VISIBLE);
                itemHolder.item_5.setVisibility(View.VISIBLE);
                itemHolder.item_6.setVisibility(View.VISIBLE);
                itemHolder.item_7.setVisibility(View.VISIBLE);
                itemHolder.item_8.setVisibility(View.GONE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(4)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_4.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(5)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_5.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(6)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_6.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(7)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_7.getChildAt(0));
                break;
            default:
                itemHolder.item_0.setVisibility(View.VISIBLE);
                itemHolder.item_1.setVisibility(View.VISIBLE);
                itemHolder.item_2.setVisibility(View.VISIBLE);
                itemHolder.item_3.setVisibility(View.VISIBLE);
                itemHolder.item_4.setVisibility(View.VISIBLE);
                itemHolder.item_5.setVisibility(View.VISIBLE);
                itemHolder.item_6.setVisibility(View.VISIBLE);
                itemHolder.item_7.setVisibility(View.VISIBLE);
                itemHolder.item_8.setVisibility(View.VISIBLE);
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(0)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_0.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(1)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_1.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(2)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_2.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(3)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_3.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(4)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_4.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(5)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_5.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(6)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_6.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(7)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_7.getChildAt(0));
                Picasso.with(context).load(Http.BASE_UPLOADS + pics.get(8)).resize(200, 200).centerCrop().into((ImageView) itemHolder.item_8.getChildAt(0));
                break;
        }
    }

    @Override
    public int getItemCount() {
        return mStorys.size() + 1;
    }

    @Override
    public int getItemViewType(int position) {
        int type = TYPE_ITEM;
        if (position == getItemCount() - 1) {
            type = TYPE_FOOT;
        }
        return type;
    }


    public void clearDatas() {
        mStorys.clear();
    }

    public void addDatas(List<ResultStory> storys) {
        mStorys.addAll(storys);
        notifyDataSetChanged();
    }


    /**
     * 列表item
     */
    class ItemHolder extends RecyclerView.ViewHolder {

        TextView story_like;  //故事喜欢数量
        TextView story_text;  //故事文本
        TextView story_comment;   //故事评论
        TextView story_city;      //发布城市
        ImageView story_sex;      //发布人性别
        TextView story_nikename;  //发布人昵称
        TextView story_send_time; //发布时间
        SelectableRoundedImageView story_portrait;    //发布人头像
        ImageView story_single_image;       //单图图像
        LinearLayout story_more_image;
        SquareLayout item_0, item_1, item_2, item_3, item_4, item_5, item_6, item_7, item_8;
        View hasMore;

        public ItemHolder(View itemView) {
            super(itemView);
            story_portrait = (SelectableRoundedImageView) itemView.findViewById(R.id.story_portrait);

            story_like = (TextView) itemView.findViewById(R.id.story_like);
            story_text = (TextView) itemView.findViewById(R.id.story_text);
            story_comment = (TextView) itemView.findViewById(R.id.story_comment);
            story_city = (TextView) itemView.findViewById(R.id.story_city);
            story_sex = (ImageView) itemView.findViewById(R.id.story_sex);
            story_nikename = (TextView) itemView.findViewById(R.id.story_nikename);
            story_send_time = (TextView) itemView.findViewById(R.id.story_send_time);

            story_single_image = (ImageView) itemView.findViewById(R.id.story_single_image);
            story_more_image = (LinearLayout) itemView.findViewById(R.id.story_more_image);

            item_0 = (SquareLayout) itemView.findViewById(R.id.item_0);
            item_1 = (SquareLayout) itemView.findViewById(R.id.item_1);
            item_2 = (SquareLayout) itemView.findViewById(R.id.item_2);
            item_3 = (SquareLayout) itemView.findViewById(R.id.item_3);
            item_4 = (SquareLayout) itemView.findViewById(R.id.item_4);
            item_5 = (SquareLayout) itemView.findViewById(R.id.item_5);
            item_6 = (SquareLayout) itemView.findViewById(R.id.item_6);
            item_7 = (SquareLayout) itemView.findViewById(R.id.item_7);
            item_8 = (SquareLayout) itemView.findViewById(R.id.item_8);
            hasMore = itemView.findViewById(R.id.has_more);

        }
    }

    class FootHolder extends RecyclerView.ViewHolder {

        public FootHolder(View itemView) {
            super(itemView);
        }
    }


}
